<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>外边距合并现象</title>
    <style>
        .box1 {
            width: 100px;
            height: 100px;
            background-color: rgb(50, 132, 203);
            margin-bottom: 20px;
        }

        .box2 {
            width: 200px;
            height: 200px;
            background-color: red;
            margin-top: 50px;
        }

        .box3 {
            width: 200px;
            height: 200px;
            background-color: red;
            margin-top: 50px;
            display: inline-block;
            margin-right: 100px;
        }

        .box4 {
            width: 200px;
            height: 200px;
            background-color: red;
            display: inline-block;
            margin-left: 200px;
        }
    </style>
</head>

<body>
    <!-- 
        外边距合并问题
        原因:第一个盒子给下(右)边距,第二个盒子给上(左)边距
        合并问题:合并一个边距值大的,并不是边距相加
     -->
    <div class="box1"></div>
    <div class="box2"></div>

    <span class="box3"></span>
    <span class="box4"></span>
</body>

</html>